namespace PureRobot.Digi.ConnectME.JumpStart.SerialFun
{
    using System;
    using System.Collections;
    using System.Net;
    using System.Net.Sockets;
    using System.Runtime.CompilerServices;
    using System.Text;
    using System.Threading;
    using Microsoft.SPOT;
    using Microsoft.SPOT.Hardware;
    using Microsoft.SPOT.Net;
    using Microsoft.SPOT.Net.NetworkInformation;

    /// <summary>
    /// Main entry point container class.
    /// </summary>
    public class Start
    {
        /// <summary>
        /// Main entry point for the application.
        /// </summary>
        public static void Main()
        {
            SerialPort.Configuration config = new SerialPort.Configuration(SerialPort.Serial.COM1, SerialPort.BaudRate.Baud115200, false);
            using (SerialPortEx serialPort = new SerialPortEx(config))
            {
                serialPort.Echo = true;
                serialPort.ReadLineCharacters = "\r";
                serialPort.WriteLineCharacters = "\r\n";
                
                serialPort.WriteLine();
                serialPort.WriteLine();
                serialPort.WriteLine("Hi there!!");

                string response = serialPort.ReadLine();

                serialPort.WriteLine();
                serialPort.WriteLine("Did you say '" + response + "'?");

                serialPort.ReadLine();

                serialPort.WriteLine();
                serialPort.WriteLine("OK, I get it. Bye!");

            }
        }
    }
}
